Skip to content

Commit 1b3731b

Browse files
committed
gha: trying to fix linux + windows testing
1 parent 2843d24 commit 1b3731b

File tree

2 files changed

+55
-9
lines changed

2 files changed

+55
-9
lines changed

sqlite-vec.c

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,52 @@
1212
#include "sqlite3ext.h"
1313
SQLITE_EXTENSION_INIT1
1414

15+
#ifdef HAVE_STDINT_H
16+
#include <stdint.h>
17+
#endif
18+
#ifdef HAVE_INTTYPES_H
19+
#include <inttypes.h>
20+
#endif
21+
22+
#ifndef UINT32_TYPE
23+
# ifdef HAVE_UINT32_T
24+
# define UINT32_TYPE uint32_t
25+
# else
26+
# define UINT32_TYPE unsigned int
27+
# endif
28+
#endif
29+
#ifndef UINT16_TYPE
30+
# ifdef HAVE_UINT16_T
31+
# define UINT16_TYPE uint16_t
32+
# else
33+
# define UINT16_TYPE unsigned short int
34+
# endif
35+
#endif
36+
#ifndef INT16_TYPE
37+
# ifdef HAVE_INT16_T
38+
# define INT16_TYPE int16_t
39+
# else
40+
# define INT16_TYPE short int
41+
# endif
42+
#endif
43+
#ifndef UINT8_TYPE
44+
# ifdef HAVE_UINT8_T
45+
# define UINT8_TYPE uint8_t
46+
# else
47+
# define UINT8_TYPE unsigned char
48+
# endif
49+
#endif
50+
#ifndef INT8_TYPE
51+
# ifdef HAVE_INT8_T
52+
# define INT8_TYPE int8_t
53+
# else
54+
# define INT8_TYPE signed char
55+
# endif
56+
#endif
57+
#ifndef LONGDOUBLE_TYPE
58+
# define LONGDOUBLE_TYPE long double
59+
#endif
60+
1561
typedef u_int8_t uint8_t;
1662
typedef u_int16_t uint16_t;
1763
typedef u_int64_t uint64_t;
@@ -4162,7 +4208,6 @@ int vec0Update_Insert(sqlite3_vtab *pVTab, int argc, sqlite3_value **argv,
41624208
int rc = vector_from_value(valueVector, &vectorDatas[i], &dimensions,
41634209
&elementType, &cleanups[i], &pzError);
41644210
todo_assert(rc == SQLITE_OK);
4165-
printf("%d %d\n", elementType, p->vector_columns[i].element_type);
41664211
assert(elementType == p->vector_columns[i].element_type);
41674212

41684213
if (dimensions != p->vector_columns[i].dimensions) {

tests/test-loadable.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
EXT_PATH = "./dist/vec0"
1616

17+
SUPPORTS_SUBTYPE = sqlite3.version_info[1] > 38
1718

1819
def bitmap_full(n: int) -> bytearray:
1920
assert (n % 8) == 0
@@ -136,7 +137,8 @@ def test_vec_bit():
136137
vec_bit = lambda *args: db.execute("select vec_bit(?)", args).fetchone()[0]
137138
assert vec_bit(b"\xff") == b"\xff"
138139

139-
assert db.execute("select subtype(vec_bit(X'FF'))").fetchone()[0] == 224
140+
if SUPPORTS_SUBTYPE:
141+
assert db.execute("select subtype(vec_bit(X'FF'))").fetchone()[0] == 224
140142

141143
with pytest.raises(
142144
sqlite3.OperationalError, match="zero-length vectors are not supported."
@@ -165,7 +167,8 @@ def test_vec_f32():
165167
for test in tests:
166168
assert vec_f32(json.dumps(test)) == _f32(test)
167169

168-
assert db.execute("select subtype(vec_f32(X'00000000'))").fetchone()[0] == 223
170+
if SUPPORTS_SUBTYPE:
171+
assert db.execute("select subtype(vec_f32(X'00000000'))").fetchone()[0] == 223
169172

170173
with pytest.raises(
171174
sqlite3.OperationalError, match="zero-length vectors are not supported."
@@ -207,7 +210,9 @@ def test_vec_int8():
207210
vec_int8 = lambda *args: db.execute("select vec_int8(?)", args).fetchone()[0]
208211
assert vec_int8(b"\x00") == _int8([0])
209212
assert vec_int8(b"\x00\x0f") == _int8([0, 15])
210-
assert db.execute("select subtype(vec_int8(?))", [b"\x00"]).fetchone()[0] == 225
213+
214+
if SUPPORTS_SUBTYPE:
215+
assert db.execute("select subtype(vec_int8(?))", [b"\x00"]).fetchone()[0] == 225
211216

212217

213218
def npy_cosine(a, b):
@@ -584,23 +589,19 @@ def test_smoke():
584589
db.execute("create virtual table vec_xyz using vec0( a float[2] )")
585590
assert execute_all(
586591
db,
587-
"select name, ncol from pragma_table_list where name like 'vec_xyz%' order by name;",
592+
"select name from sqlite_master where name like 'vec_xyz%' order by name;",
588593
) == [
589594
{
590595
"name": "vec_xyz",
591-
"ncol": 4,
592596
},
593597
{
594598
"name": "vec_xyz_chunks",
595-
"ncol": 4,
596599
},
597600
{
598601
"name": "vec_xyz_rowids",
599-
"ncol": 4,
600602
},
601603
{
602604
"name": "vec_xyz_vector_chunks00",
603-
"ncol": 2,
604605
},
605606
]
606607
chunk = db.execute("select * from vec_xyz_chunks").fetchone()

0 commit comments

Comments
 (0)